package com.gitee.limaozhi.util;

import java.util.concurrent.TimeUnit;

/**
 * @author hzlimaozhi
 * @date 2019/08/23 18:03
 */
public class Utils {

    public static void sleepMillis(long millis) {
        try {
            Thread.sleep(millis);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void sleepSeconds(int seconds) {
        try {
            Thread.sleep(seconds * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void sleep(TimeUnit timeUnit, long timeout) {
        try {
            timeUnit.sleep(timeout);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static byte[] copy(byte[] src, int start, int length) {
        byte[] dst = new byte[length];
        System.arraycopy(src, start, dst, 0, length);
        return dst;
    }

    public static byte[] copy(byte[] src, int length) {
        return copy(src, 0, length);
    }

}
